{include file="common/head"}
<head>
  <title>教练信息登记</title>
    <link rel="stylesheet" href="/static/flatpickr/flatpickr.min.css">
    <script src="/static/flatpickr/flatpickr.js"></script>
</head>
<style>
  label{width: 18%;}
  .form-control{display:inline-block;width: 80%;}
</style>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;" >
    <h2>教练信息登记</h2>
    <form method="post" action="/index.php/customer/customer_add/type/2">

       <div class="mb-3">
        <label for="name" class="form-label">姓名:</label>
        <input type="text" class="form-control" id="name" name="name" value="" placeholder="姓名" />
      </div>
      <div class="mb-3">
        <label for="mobile" class="form-label">手机号码:</label>
        <input type="text" class="form-control" id="mobile" name="mobile" value="" placeholder="手机号码" />
      </div>
      <div class="mb-3">
        <label for="id_card" class="form-label">身份证号码:</label>
        <input type="text" class="form-control" id="id_card" name="id_card" value="" placeholder="身份证号码" />
      </div>  
         
      <div class="mb-3">
        <label for="address" class="form-label">现居地址:</label>
        <input type="text" class="form-control" id="address" name="address" value="" placeholder="现居地址" />
      </div>      
<!--       <div class="mb-3">
        <label for="wx" class="form-label">微信号:</label>
        <input type="text" class="form-control" id="wx" name="wx" value="" placeholder="微信号" />
      </div> -->
<!--       <div class="mb-3">
        <label for="birth_date" class="form-label">出生日期:</label>
        <input type="text" class="form-control" id="birth_date" name="birth_date" value="" placeholder="出生日期" />
      </div> -->
      <div class="mb-3">
        <label for="tel" class="form-label">准教车型:</label>
        <input type="text" class="form-control" id="tel" name="tel" value="" placeholder="准教车型,C1,C2..." />    
      </div>   
      <div class="mb-3">
        <label for="tel" class="form-label">教练级别:</label>
        <select class="form-control" name="trainer_level" id="trainer_level">
          {foreach $t_levels as $k=>$v}
            <option value="{$k}">{$v}</option>
          {/foreach}
        </select>
      </div>

      <div class="mb-3">
        <label for="sex" class="form-label">性别:</label>
          <input type="radio" class="form-check-input" id="radio1" name="sex" value="1"  checked {/if}/> 
          <label class="form-check-label" for="radio1">男</label>
          <input type="radio" class="form-check-input" id="radio2" name="sex" value="2"  {/if}/>
          <label class="form-check-label" for="radio2">女</label>
      </div>
      <div class="mb-3">
        <label for="job_years" class="form-label">教龄:</label>
        <input type="number" class="form-control" id="job_years" name="job_years" value="" placeholder="教龄" />
      </div>

      <div class="mb-3">
        <label for="desc" class="form-label">教练格言:</label>
        <textarea class="form-control" id="desc" name="desc" style="height: 60px;"></textarea>
      </div>      
      <div class="mb-3">
        <label for="status" class="form-label">状态:</label>
          <input type="radio" class="form-check-input" id="radio3" name="status" value="1"  checked /> 
          <label class="form-check-label" for="radio3">正常</label>
          <input type="radio" class="form-check-input" id="radio4" name="status" value="2" />
          <label class="form-check-label" for="radio4">关闭</label>
       </div>

      <button  type="button" class="btn btn-primary" onclick="doSave()">保存教练资料</button>

    </form>
    </div>

<script type="text/javascript">
    flatpickr("#birth_date", {});
    $(".birth_date").flatpickr({
        enableTime: true,
        dateFormat: "Y-m-d H:i:s",
    });  
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的姓名!");
        return 0;
      }    
      if(!$("#mobile").val()) {
        layer.msg("无效的电话!");
        return 0;
      }

      if(!$("#id_card").val()){
        layer.msg("无效的身份证号码！");
        return;
      }

      if(!$("#native_address").val() || !$("#address").val()){
        layer.msg("无效的地址！");
        return;
      }    
      //询问框
      layer.confirm('是否确定保存?', {
        btn: ['是的','取消'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("已取消!");
        return 0;
      });
    }

</script>


</body>
</html>
